package org.capybara.coffeehouse.insteon;

import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.capybara.coffeehouse.controller.Configuration;
import org.capybara.coffeehouse.device.InsteonDevice;

public class PlmTest {

	private static final Logger log = Logger.getLogger(PlmTest.class);
	/**
	 * @param args
	 */
	
	public static final InsteonAddress plmAddress = new InsteonAddress(0x13,0x26,0x25);
		
	public static void main(String[] args) throws IOException, InterruptedException {
		BasicConfigurator.configure();
		
		RS232SerialPort port = new RS232SerialPort("/dev/tty.usbserial-A700aicy", 19200, 100);
		
		BlockingQueue<InsteonMessage> inputQueue = new LinkedBlockingQueue<InsteonMessage>();
		
		//List<InsteonDevice> deviceList = Arrays.asList();
		
		ExecutorService executor = Executors.newSingleThreadExecutor();
		PlmDriver plmDriver = new PlmDriver(port);

		Configuration c = new Configuration();
		InsteonDevice light1 = (InsteonDevice) c.getDeviceByName("light1");
		light1.setPlm(plmDriver);
		
		plmDriver.addEventListner(light1);
		
		executor.execute(plmDriver);
		
		
	}
}
